package com.water.wfo.component.config;


import com.alibaba.fastjson.parser.ParserConfig;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Component;

import javax.annotation.PostConstruct;

/*
 * @Author Administrator
 * @Description 启用FastJson安全模式
 * @Date 2024/6/13 16:14
 *
 */
@Component
public class FastJsonConfig {
    private static final Logger LOGGER = LoggerFactory.getLogger(FastJsonConfig.class);

    @PostConstruct
    public void setSafeMode(){
        try {
            ParserConfig.getGlobalInstance().addAccept("com.water.");
        }catch (Exception e){
            LOGGER.error("fastjson设置白名单异常", e);
        }
    }
}
